The function getLocksInModule seems to be failing when I try to get a LockList for a particular module. This is true even though I have admin status on our database. Here's the code, and it's never entering the LockList loop.
LockList lcklst = getLocksInModule(mn,true)
Lock lck
print "before loop\n"
for lck in lcklst do
{
print "in loop\n"
s = lck.user
i = lck.lockMode
if (i == 2)
{
lt = "Exclusive"
}
if (i == 1)
{
lt = "Shareable"
}
if (i != 2 && i != 1)
{
lt = "No Lock Found"
}
if (existsUser(s))
{
u = find(s)
uName = u.fullName
if (uName == null)
{
uName = "No Name Entered"
}
}
else
{
uName = "User Not Found"
}
scnResTemp = scnResTemp s "\t\t" uName "\t\t\t" lt "\n"
}
This code is trying to get the current users that have locks on a module. Currently it isn't finding any users.
SystemAdmin - Fri Feb 27 17:00:20 EST 2009 |
|
Re: getLocksInModule fails llandale - Sun Mar 01 14:51:25 EST 2009
Modified the code and made it work; silly autodeclare is turned off as is un initialized variable warnings are turned on.
Code seems to work. You don't get your OWN locks ..err.. you don't get locks in this instance of DOORS, but if you run DOORS in one instance and Edit the module, then run DOORS in another instance and Read the module and run the code, you'll see the other instance.
>Louie
Attachments
attachment_14222968_getLocksInModule_Test.dxl
|
|
Re: getLocksInModule fails SystemAdmin - Mon Mar 02 08:08:06 EST 2009 llandale - Sun Mar 01 14:51:25 EST 2009
Modified the code and made it work; silly autodeclare is turned off as is un initialized variable warnings are turned on.
Code seems to work. You don't get your OWN locks ..err.. you don't get locks in this instance of DOORS, but if you run DOORS in one instance and Edit the module, then run DOORS in another instance and Read the module and run the code, you'll see the other instance.
>Louie
Thanks, I'll give it a try when I get the chance. This isn't the complete code as there's code to handle the user's current locks. What got changed to make the code work?
|
|
Re: getLocksInModule fails llandale - Mon Mar 02 15:04:16 EST 2009 SystemAdmin - Mon Mar 02 08:08:06 EST 2009
Thanks, I'll give it a try when I get the chance. This isn't the complete code as there's code to handle the user's current locks. What got changed to make the code work?
Declared the variables, initialized the ones that needed to be initialized, added 'lockXxx' paramters, tweaked some things; but the logic was sound and it just works. As I said, it gets the OTHER folk's locks, not yours.
|
|
Re: getLocksInModule fails SystemAdmin - Wed Mar 04 10:09:08 EST 2009 llandale - Mon Mar 02 15:04:16 EST 2009
Declared the variables, initialized the ones that needed to be initialized, added 'lockXxx' paramters, tweaked some things; but the logic was sound and it just works. As I said, it gets the OTHER folk's locks, not yours.
Discovered that the original script is fine, there's an issue with some of our accounts that for whatever reason can't use the getLocks function. Thanks for your help and I'll keep the updated getLocks you attached.
|
|
Re: getLocksInModule fails SystemAdmin - Wed Mar 04 12:45:37 EST 2009 SystemAdmin - Wed Mar 04 10:09:08 EST 2009
Discovered that the original script is fine, there's an issue with some of our accounts that for whatever reason can't use the getLocks function. Thanks for your help and I'll keep the updated getLocks you attached.
Is the correct behavior for getLocksInModule is to work only when the user running it has the Manage Database privilege. From my understanding this was not correct, that it should work as long as you don't try to edit the locks that are retrieved. Is there a way around using this function to get the locks in a module to see who is using the module?
|
|
Re: getLocksInModule fails llandale - Wed Mar 04 14:37:38 EST 2009 SystemAdmin - Wed Mar 04 12:45:37 EST 2009
Is the correct behavior for getLocksInModule is to work only when the user running it has the Manage Database privilege. From my understanding this was not correct, that it should work as long as you don't try to edit the locks that are retrieved. Is there a way around using this function to get the locks in a module to see who is using the module?
The descriptions for all those 3 lock loops is fairly clear: "... and if the current user has may manage power..", meaning the following prints true:
User usr = find() // current user handle'
bool YesICan = usr.mayManage
print "I May Manage: " YesICan "\n"
// Following line fails; must stage 'usr.mayManage' in boolean
// variable before using it:
// print "I May Manage: " (usr.mayManage) "\n"
So only users who may manage the database may use this lockList stuff.
|
|
Re: getLocksInModule fails SystemAdmin - Fri Mar 06 12:40:02 EST 2009 llandale - Wed Mar 04 14:37:38 EST 2009
The descriptions for all those 3 lock loops is fairly clear: "... and if the current user has may manage power..", meaning the following prints true:
User usr = find() // current user handle'
bool YesICan = usr.mayManage
print "I May Manage: " YesICan "\n"
// Following line fails; must stage 'usr.mayManage' in boolean
// variable before using it:
// print "I May Manage: " (usr.mayManage) "\n"
So only users who may manage the database may use this lockList stuff.
Ok, is there a way around using the locklist to get what locks users have in a module? I need a way for standard users to be able to see the current locks on a module.
|
|